/**
 * Created by leezhenbo on 15/5/26.
 */
package objects {
import starling.core.Starling;
import starling.display.MovieClip;
import starling.display.Sprite;
import starling.events.Event;

public class Hero extends Sprite{
    private var heroArt:MovieClip;
    public function Hero() {
        this.addEventListener(Event.ADDED_TO_STAGE,onAddedToStageHandler);
    }

    private function onAddedToStageHandler(event:Event):void{
        this.removeEventListener(Event.ADDED_TO_STAGE,onAddedToStageHandler);
        createHeroArt();
    }

    private function createHeroArt():void{
        heroArt = new MovieClip(Assets.getTextureAtlas().getTextures('fly_'),20);
        heroArt.x = Math.ceil(-heroArt.width/2);
        heroArt.y = Math.ceil(-heroArt.height/2);
        Starling.juggler.add(heroArt);

        this.addChild(heroArt);
    }
}
}
